#include "stdafx.h"
#include "rcoterminal.h"

RcoTerminal::RcoTerminal(QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	ui.setupUi(this);

	bool b = connect(&m_IODevice, SIGNAL(CommandReport(const QString&)), this,
		SLOT(readMessage(const QString&)));

	m_IODevice.connectToHost(QHostAddress::LocalHost, 6608);
}

RcoTerminal::~RcoTerminal()
{

}

void RcoTerminal::on_m_btnGo_clicked()
{
	m_IODevice.Write(ui.m_edCmdLine->text());
	ui.m_edCmdLine->clear();
}

void RcoTerminal::readMessage(const QString& str)
{
	QString cx = ui.textEdit->toPlainText();
	ui.textEdit->setText(cx + str);
	return;
}
